﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ObjectBuilder
{
    /// <summary>
    /// Holder informací o třídách v Assembly
    /// </summary>
    public class Item
    {
        private int parrentIndex = -1;
        private int interfaceIndex = -1;
        private int classIndex;
        private string name;
        private string name_;
        private int[] binding = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
        private int index = 0;

        #region Property
        public int InterfaceIndex
        {
            get { return interfaceIndex; }
            set { this.interfaceIndex = value; }
        }
        public int ParentIndex
        {
            get { return parrentIndex; }
            set { this.parrentIndex = value; }
        }
        public int ClassIndex
        {
            get { return classIndex; }
            set { this.classIndex = value; }
        }
        public string Name
        {
            get { return name; }
            set { this.name = value; }
        }
        public string Name_
        {
            get { return name_; }
            set { this.name_ = value; }
        }
        public int[] Association
        {
            get { return this.binding; }
        }
        public void setBinding(int value)
        {
            this.binding[index] = value;
            this.index++;
        }
        #endregion
        /// <summary>
        /// Porovná dva Itemy na základě jména a namespacu
        /// </summary>
        /// <param name="item"> Item k porovnání</param>
        /// <returns>
        /// true : pokud jsou shodné
        /// false : pokud nejsou shodné
        /// </returns>
        public bool compareTo(Item item)
        {
            if(item.Name.Equals(this.Name) && item.Name_.Equals(this.Name_))
                return true;
            return false;
        }
        /// <summary>
        /// Porovná dva Itemy na základě jména a namespacu
        /// </summary>
        /// <param name="n">n - name, jmeno třídy</param>
        /// <param name="n_">n_ - namespace třídy</param>
        /// <returns>
        /// true : pokud jsou shodné
        /// false : pokud nejsou shodné
        /// </returns>
        public bool compareTo(string n, string n_)
        {
            if (n.Equals(this.Name) && n_.Equals(this.Name_))
                return true;
            return false;
        }
    }
}
